var t = getApp();

Page({
    data: {
        bank: [],
        show1: !1,
        arr: [],
        amount: "",
        pay_sn: "",
        bank_name: "",
        code: "",
        order_pay_sn: "",
        payer_phone: "",
        pay_type: "",
        card_no: "",
        check_open: !1
    },
    onLoad: function(t) {},
    onReady: function() {},
    onShow: function() {
        this.initData(), this.getType();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    initData: function() {
        this.setData({
            bank: [],
            show1: !1,
            arr: [],
            amount: "",
            pay_sn: "",
            bank_name: "",
            code: "",
            order_pay_sn: "",
            payer_phone: "",
            pay_type: "",
            card_no: ""
        });
    },
    toPay: function(t) {
        var e = t.currentTarget.dataset.item;
        0 == e.status && 2 == this.data.pay_type && wx.navigateTo({
            url: "/packageD/quickPay/member_bind_bank/member_bind_bank?card_id=" + e.id
        });
    },
    toAdd: function() {
        wx.navigateTo({
            url: "/packageD/quickPay/member_add_bank_first/member_add_bank_first"
        });
    },
    tapUnbound: function(t) {
        var e = this, n = t.currentTarget.dataset.item;
        this.data.check_open ? this.toRemove(n) : wx.showModal({
            title: "提示",
            content: "此操作将解绑该银行卡，确认执行该操作吗？",
            success: function(t) {
                t.confirm && e.deleteBank(n);
            }
        });
    },
    toRemove: function(t) {
        wx.navigateTo({
            url: "/packageD/quickPay/member_remove_bank/member_remove_bank?card_id=" + t.id
        });
    },
    deleteBank: function(e) {
        var n = this, a = t.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.del");
        t._getNetWork({
            url: a,
            data: {
                card_id: e.id
            },
            showToastIn: !1,
            success: function(t) {
                var e = t.data;
                1 == e.result ? (wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                }), n.setData({
                    show1: !1
                }), n.getBank()) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getBank: function() {
        var e = this, n = t.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.index");
        t._getNetWork({
            url: n,
            showToastIn: !1,
            success: function(t) {
                var n = t.data;
                1 == n.result ? (e.setData({
                    bank: n.data
                }), e.getMemberPhone()) : (e.setData({
                    bank: n.data
                }), wx.showToast({
                    icon: "none",
                    title: n.msg,
                    duration: 1500
                }));
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getType: function() {
        var e = this, n = t.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.get-pay-type");
        t._getNetWork({
            url: n,
            showToastIn: !1,
            success: function(t) {
                var n = t.data;
                1 == n.result ? (e.setData({
                    pay_type: n.data.pay_type
                }), e.getBank()) : wx.showToast({
                    icon: "none",
                    title: n.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getMemberPhone: function() {
        var e = this, n = t.getNetAddresss("plugin.converge_pay.frontend.controllers.quick-pay-bank-card.get-mobile");
        t._getNetWork({
            url: n,
            showToastIn: !1,
            success: function(n) {
                var a = n.data;
                1 === a.result ? e.setData({
                    check_open: a.data.sms_check_open
                }) : t.tips(a.msg);
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    }
});